[bug fix] Always return one split_dict shard per DP rank - #102
Merged
Conversation
Signed-off-by: Stas Bekman <stas.bekman@snowflake.com>
Signed-off-by: Stas Bekman <stas.bekman@snowflake.com>
sfc-gh-sbekman
enabled auto-merge (squash)
September 1, 2026 21:57
sfc-gh-truwase
approved these changes
Sep 2, 2026
…t-dict-chunk Signed-off-by: Stas Bekman <stas.bekman@snowflake.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(also removes an accidentally committed PR_DESCRIPTION.md in one of my previous PRs)
split_dict/_split_valueusedtorch.chunk, which can return fewer thannum_chunkstensors (for example B=6 at dp=4 → 3 chunks of 2). Indexing the missing chunk isIndexErrorand/forward-backward500s. The same helper splits GAS microbatches on the worker.Use
torch.tensor_splitso there is always one shard per rank whenB >= n. Rows are conserved.B < nstill raisesValueError.Testing
CPU in this clone (
PYTHONPATH= checkout):tests/common/test_split_dict.pyfailed onmain(IndexErrorat B=6 n=4), then 2 passed after the fix. Neighbortests/common/test_finalize_fwd_bwd_metrics.py,tests/common/test_prune_checkpoint_dirs.py, andtests/sft/test_sft_edge_cases.py::TestGasMicrobatchListpassed (10 + 2).